<template>
    <div class="bg">
              <!-- <Loading v-show="LOADING"></Loading> -->

        <nav-com title="分享记录" :showView='showView' @back="backHandler()"></nav-com>
        <van-pull-refresh v-model = 'isLoading' @refresh='onRefresh'>
        <div v-if="list.length==0" class="empty">
            <img src='../../assets/t4.png'>
            <p>您还没有分享记录哦~</p>
        </div>
        <ul class="teamlist">
            <van-list v-model="loading" :finished="finished" @load="onload">
            <li v-for="(item,index) in list" :key="index">
                <div class="teamlist_bottom">
                    <p>{{item.mobile}}({{item.role_name }})</p>   
                    <!-- <span v-if="item.parentUserId > 0" style="color:green;">已归属</span>
                    <span v-if="item.parentUserId == 0" style="color:red;">未归属</span> -->
                </div>
                <div class="teamlist_title">{{item.addtime}}</div>
                
            </li>
            </van-list>
        </ul>
        </van-pull-refresh>
    </div>
</template>
<script>
import {getFttusers,get_depar_list}  from '@/api/api'
import navCom from '@/component/nav'
import Loading  from '@/component/loading'

export default {
    name:'referralChildCountHandler',
    components:{
        navCom,Loading
    },
    data() {
        return {
            showView:true,
            uid: weixin.getUserId(),
            list:[],
            isLoading:false,
            // loading:true,
            finished:false,
            total:0,
            pageNo:1,
            LOADING:false
        }
    },
    mounted(){
         this.init()
    },
    methods:{
        //返回
        backHandler(){
            this.$router.go(-1)
        },
        onRefresh(){
            console.log("onRefresh");
            this.pageNo = 1
            if(this.finished==false){
                this.list = []
                this.init()
            }
            
            this.isLoading = false
        },
        //数据加载
        onload(){
            // this.init()
        },
        //初始化团队奖励
        init(){
            this.LOADING=true
            get_depar_list().then(res=>{
                    console.log("get_depar_list",res)
                    this.LOADING = false
                    if(res.data.code == 1){
                        let newData=res.data.data;
                        if(newData.length == 0){
                            this.finished = true
                        }else {
                            // this.pageNo++
                            this.list = newData;
                            this.finished = false
                            this.loading = false
                        }
                     
                    }else {
                        this.$dialog.alert({
                            message:res.data.msg
                        })
                }
            })
            // getFttusers({referralParentUserId:this.uid,pageNo:this.pageNo}).then(res=>{
            //     if(res.data.code == 200){
            //         this.pageNo++
            //         this.list = this.list.concat(res.data.data.rows)
            //         this.total = res.data.data.total
            //         if(this.list.length < 1 ){
            //             this.finished = true
            //         }else if(this.list.length >= this.total){
            //             this.finished = true
            //         }else {
            //             this.finished = false
            //             this.loading = false
            //         }
            //     }else {
            //         this.$dialog.alert({
            //             message:res.data.msg
            //         })
            //     }
            // })
        }
    }
}
</script>
<style scoped>
p {padding:0; margin:0;}
.bg {background: #F1F3F6; min-height: 100vh;}
.teamlist {margin:0 4vw; height:auto; overflow: hidden;}
.teamlist li {background: #fff;  margin-top:4vw; height:auto; overflow: hidden; display: flex;}
.teamlist_title {padding-left:10vw; border-radius: 1.3vw; color:#999; height:12vw; line-height:12vw;}
.teamlist_bottom {display: flex; justify-content: space-between; height:12vw; line-height: 12vw;}
.teamlist_bottom p {padding-left:4vw;  color:#333;}
.teamlist_bottom span {padding-right:4vw; color:#FF0000;}
.empty {padding-top:29.33vw; text-align: center;}
.empty img {width:54.4vw; height:37.6vw;}
.empty p {font-size:3vw; color:#333; margin-top:4vw;}
</style>